#ifndef __UESAPI
#define __UESAPI

#include <stdlib.h>

// Core api, should be transfered to us
typedef struct ues_core_api_s
{
	void			(*Print)				(char *str, ...);
	void			(*OnMemoryExecAlloc)	(void *pMem, unsigned int sSize);
} ues_core_api_t;

// Transfer this to the core
typedef struct ues_api_s
{
	void*			(*CreateEnv)			();															// Create a new environment
	int				(*CreateStruct)			(void *pEnv, char *sDefName, unsigned char nArgs, ...);		// Creates a struct
	int				(*CreateSingleDef)		(void *pEnv, char *sDefName, unsigned char ucType);			// Creates a single referal definition
	int				(*GetStructByName)		(void *pEnv, char *sDefName);								// Gets a struct by name
	int				(*GetSingleDefByName)	(void *pEnv, char *sDefName);								// Gets a single referal definition by name
	void*			(*CreateArgArea)		(unsigned char numArgs, ...);								// Creates a argumental area
	unsigned char	(*InitFunction)			(void *ptr, const char *name, void *env, unsigned char retCast, int iID, void *retArgs, void *args);		// Loads a function into a environment
	void*			(*Load)					(unsigned char *filename, void *env);						// Load a specific file and return memory location
	void*			(*LoadBuffer)			(char *pBuffer, size_t sBuffer, void *pEnv);				// Load a script by buffer
	void			(*FreeBinary)			(void *pEnv, void *pCode);									// Free a binary chunk
	void			(*FreeEnvironment)		(void *pEnv);												// Free the whole environment
#ifdef _DEBUG
	void			(*PrintMemoryUsage)		();															// Get the current memory usage
#endif
} ues_api_t;

// Entry point to the library.
ues_api_t* UESLoadAPI(ues_core_api_t *capi);

#endif //__UESAPI